package 学生管理系统;

//1.任务描述
//编写一个程序，模拟学生管理系统。
// 可以实现对学生信息的添加、删除、修改和查询功能，要求使用List集合存储自定义的对象集合，
// 并熟练使用List集合的中常用方法实现相关的操作。

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        ManagerSystem managerSystem = new ManagerSystem();
        Scanner sc = new Scanner(System.in);
        //选择管理操作
        while(true)
        {
            System.out.println("=====================================");
            System.out.println("Student Management System");
            System.out.println("1. Add Student");
            System.out.println("2. Delete Student");
            System.out.println("3. Search Student");
            System.out.println("4. Update Student");
            System.out.println("5. Display Students");
            System.out.println("6. Exit");
            System.out.println("=====================================");
            System.out.print("Enter your choice: ");
            int choice = sc.nextInt();

            switch (choice) {
                case 1:
                    System.out.println("请输入学生ID");
                    String ID = sc.next();
                    System.out.println("请输入学生姓名");
                    String name = sc.next();
                    System.out.println("请输入学生性别");
                    String gender = sc.next();
                    System.out.println("请输入学生年龄");
                    int age = sc.nextInt();
                    Student student = new Student(ID, name, gender, age);
                    managerSystem.addStudent(student);
                    break;
                case 2:
                    System.out.println("请输入要删除学生的ID");
                    managerSystem.deleteStudent(sc.next());
                    break;
                case 3:
                    System.out.println("请输入要查询学生的ID");
                    managerSystem.searchStudent(sc.next());
                    break;
                case 4:
                    System.out.println("请输入要更该学生的ID");
                    String upID = sc.next();
                    System.out.println("请输入更改的姓名");
                    String upname = sc.next();
                    System.out.println("请输入更改的性别");
                    String upgender = sc.next();
                    System.out.println("请输入更改的年龄");
                    int upage = sc.nextInt();
                    managerSystem.updateStudent(upID, upname, upgender, upage);
                    break;
                case 5:
                    managerSystem.displayStudent();
                    break;
                case 6:
                    System.exit(0);
                default:
                    System.out.println("选择有误，请重新选择");
            }
            System.out.println();
        }
    }
}
